package game.items;

import edu.monash.fit2099.engine.actions.ActionList;
import edu.monash.fit2099.engine.actors.Actor;
import edu.monash.fit2099.engine.items.Item;
import edu.monash.fit2099.engine.positions.GameMap;
import edu.monash.fit2099.engine.positions.Location;
import game.actions.ConsumeAction;

/**
 * 抽象可食用物品：可携带，也可在地上直接食用。
 */
public abstract class Food extends Item {

    public Food(String name, char displayChar) {
        super(name, displayChar, true);
    }

    /** 吃下后的效果，返回一段提示文本。 */
    public abstract String consumeEffect(Actor actor, GameMap map);

    /** 背包中时提供“食用”动作 */
    @Override
    public ActionList allowableActions(Actor owner, GameMap map) {
        ActionList list = new ActionList();
        list.add(new ConsumeAction(this));
        return list;
    }

    /** 放在地面上时提供“食用”动作 */
    @Override
    public ActionList allowableActions(Location location) {
        ActionList list = new ActionList();
        list.add(new ConsumeAction(this));
        return list;
    }
}
